package com.imooc.sell.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.imooc.sell.config.ConfigBean;

@RestController
public class ConfigController {

	/*@Value("${ip}") // 获取application.yml文件中名为ip的value值
	private String ip;
	
	@Value("${port}") // 获取application.yml文件中名为port的value值,并且自动完成数据类型转换
	private Integer port;

	@Value("${content}")
	private String content;*/
	
	@Autowired  
	private ConfigBean configBean; 
	 
	/*@RequestMapping("/config")
	public String config() {
		return "ip:" + ip + ",port:" + port;
	}
	@RequestMapping("/content")
	public String content() {
		return content;
	}*/
	
	@RequestMapping("/config")
	public String config() {
		System.out.println("-----查询配置的属性......configBean = "+configBean);
		return "另一种方式：   ip:"+configBean.getIp()+",port:"+configBean.getPort()+",desc:"+configBean.getDesc();
	}
	
}
